package com.newtouch.bxzs.database.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.newtouch.bxzs.common.base.model.Menu;
import com.newtouch.bxzs.database.model.bo.MenuTreeBO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 菜单Mapper:
 *
 * <p>
 * <b>History:</b>
 * <table border="1">
 * <tr>
 * <th>Date</th>
 * <th>Operator</th>
 * <th>Memo</th>
 * </tr>
 * <tr>
 * <td>2021/1/4 17:41</td>
 * <td>zhangqianyang</td>
 * <td>Create</td>
 * </tr>
 * </table>
 *
 * @author zhangqianyang
 * @version 1.0.0
 * @since 1.0.0
 */
@Mapper
public interface MenuMapper extends BaseMapper<Menu> {


    /**
     * 根据角色id删除RoleMenu中间表的数据
     *
     * @param roleId 角色id
     */
    @Delete("DELETE FROM ASSISTANT_ROLE_MENU_MAP WHERE ROLE_ID = #{roleId}")
    void deleteFromRoleMenuByRoleId(String roleId);

    /**
     * 查出所有的menu
     *
     * @param terminalType 终端类型
     * @return List<MenuTreeBO>
     */
    List<MenuTreeBO> listAllMenu(@Param("terminalType") String terminalType);
}
